
var mysqlConn = require("./BaseDao");

exports.getCoupon = function (userId,callbk) {
    mysqlConn.getConn(function (err,connection) {
        var sql = "select *,date_format(a.expire_date,'%Y-%m-%d %h:%i:%s') as expire_time from coupon_info a,coupon_base b where a.couponb_id = b.couponb_id and a.user_id = ?";
        connection.query(sql,[userId],function (err,rows) {
            connection.release();
            console.log(err);
            callbk(err,rows);
        })
    });
}